<?php

use Biz\model\brandActivity\BlindBoxCueCard as mBlindBoxCueCard;

/**
 * 提示卡列表
 */
class CueCardListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_REGISTER;

    public function main()
    {
        $list = mBlindBoxCueCard::selectByWhere(['uid' => $this->uid, 'expire_time[>]' => date('Y-m-d H:i:s'),
            'card_state' => mBlindBoxCueCard::CARD_STATE_NORMAL, 'ORDER' => ['expire_time' => 'ASC']]);
        $excludeList = [];
        foreach ($list as $row) {
            if ($row['card_type'] == mBlindBoxCueCard::CARD_TYPE_EXCLUDE) {
                $excludeList[] = [
                    'card_id' => $row['id'],
                    'card_type' => $row['card_type']
                ];
            }
        }
        $this->setSuccess(['exclude_list' => $excludeList]);
    }
}